<!DOCTYPE html>
<head>
    <meta charset="UTF-8">
    <title>v-bind</title>
    <style>
        #box {
            width: 100px;
            height: 100px;
        }
        .red{
            background-color:red;
        }
        .blue{
            background-color:blue;
        }
    </style>
</head>
<body>
    <div id="app">
        <!--<input type="button" value="红" @click="color='red'"/>
        <input type="button" value="蓝" @click="color='blue'"/>
        <br>
        <div v-bind:id="color" class="box">
            点击按钮背景会切换颜色
        </div>-->
        <input type="button" value="点击切换颜色" @click="boo=!boo"/>
        <div id="box" :class="{red:boo,blue:!boo}">
            点击按钮背景切换颜色
        </div>

    </div>
    <script src="./node_modules/vue/dist/vue.js"></script>
    <script>
        var vm=new Vue({
            el:"#app",
            data:{
                color:"",
                boo:true
            }
        })
    </script>
</body>
</html>